<template>
  <div id="app">
    <div id="form">
      <el-form :label-position="labelPosition" label-width="80px" :model="user">
        <el-form-item label="username">
          <el-input v-model="user.username"></el-input>
        </el-form-item>
        <el-form-item label="password">
          <el-input v-model="user.password"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="login">登录</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>

  export default {
    name: 'App',
    components: {},
    data() {
      return {
        labelPosition: 'right',
        user: {
          username: '',
          password: ''
        }
      }
    },
    methods: {
      login() {
        this.$http.post("/user/login", this.user).then(r => {
          console.log(r.data)
        })
      }
    }
  }
</script>

<style>
  #app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    margin-top: 60px;
  }

  #form {
    width: 250px;
  }
</style>
